package com.shengjing.apk

import android.app.Activity
import android.os.Bundle
import android.util.Log
import com.march.socialsdk.exception.SocialError
import com.march.socialsdk.listener.OnLoginListener
import com.march.socialsdk.manager.LoginManager
import com.march.socialsdk.model.LoginResult
import com.march.socialsdk.platform.Target
import kotlinx.android.synthetic.main.activity_login.*

class LoginActivity : Activity() {
    companion object {
        private const val TAG: String = "LoginActivity"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_login)
        btn_login.setOnClickListener {
            LoginManager.login(this, Target.LOGIN_WX, object : OnLoginListener {
                override fun onStart() {
                    Log.d(TAG, "Login onStart")
                }

                override fun onSuccess(loginResult: LoginResult?) {
                    Log.d(TAG, "Login success: $loginResult")
                }

                override fun onCancel() {
                    Log.d(TAG, "Login onCancel")
                }

                override fun onFailure(e: SocialError?) {
                    Log.d(TAG, "Login onFailure $e")
                }

            })
        }
    }
}
